package com.bjpowernode.redis;

import com.sun.media.jfxmediaimpl.HostUtils;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

import java.util.List;

public class Jedisdemo {
    public static void main(String[] args) {
        Jedis jedis=new Jedis("192.168.216.128",6379);
        jedis.set("username","xiongjiaxing");
        String username = jedis.get("username");
//        System.out.println(username);

        JedisPool jedisPool=new JedisPool("192.168.216.128",6379);
        Jedis jedis1 = jedisPool.getResource();
        JedisPoolConfig jedisPoolConfig=new JedisPoolConfig();
        jedisPoolConfig.setMaxTotal(10);
        jedisPoolConfig.setMaxIdle(10);
        String uname = jedis1.get("uname");
//        System.out.println(uname);
        jedis1.rpush("banji","001","002","003","004");
        List<String> banji = jedis1.lrange("banji", 0, -1);
        for (String s : banji) {
            System.out.println(s);
        }
        System.out.println("================================================");
        Long aLong = jedis1.dbSize();
        System.out.println(aLong);

    }


}
